package com.tanhua.admin.test;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.text.SimpleDateFormat;
import java.time.OffsetTime;
import java.time.ZoneOffset;
import java.util.Date;

/**
 * @Author 沈大哥
 * @Date 2022/3/6 17:22
 * @Version 1.0
 **/
public class A {
    public static void main(String[] args) {
//        long milliSecond = 1646560564579L;
        Date date = new Date();
        DateTime offset = DateUtil.offset(date, DateField.YEAR, -1);
        System.out.println("offset = " + offset);

        DateTime dateTime = DateUtil.offsetDay(date, 1);

        String format = new SimpleDateFormat("yyyy-MM-dd").format(dateTime);
        System.out.println("format = " + format);
//        date.setTime(milliSecond);
//        System.out.println("date = " + date);
//
//        String format = new SimpleDateFormat("yyyy-MM-dd").format(date);
//
//        DateTime dateTime = DateUtil.lastMonth();
//        System.out.println("dateTime = " + dateTime);
//
//        DateTime offset = dateTime.offset(DateField.MONTH, 1);
//        System.out.println("offset = " + offset);
//
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
//        String format1 = simpleDateFormat.format(dateTime);
//
//
//        System.out.println("format1 = " + format1);
//        System.out.println(format);
//        System.out.println("======================================");
//
//        DateTime time = DateUtil.offsetDay(new Date(), -1);
//        DateTime time1 = DateUtil.offset(new Date(), DateField.YEAR,-1);
//        int day = dateTime.dayOfMonth();
//        System.out.println("time = " + time);
//        System.out.println("time1 = " + time1);
//        System.out.println("day = " + day);
    }
}
